package com.heima.wemedia.feign;

import com.heima.apis.dotos.ChannelDto;
import com.heima.apis.wemedia.IWmChannelClient;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.service.WmChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WmChannelClient implements IWmChannelClient {

    @Autowired
    private WmChannelService wmChannelService;

    @PostMapping("/api/v1/feign/wemedia/channel/save")
    public ResponseResult saveWmChannel(WmChannel wmChannel) {
        return wmChannelService.saveWmChannel(wmChannel);
    }

    @GetMapping("/api/v1/feign/wemedia/channel/del/{id}")
    public ResponseResult delWmChannel(Integer id) {
        return wmChannelService.del(id);
    }

    @PostMapping("/api/v1/feign/wemedia/channel/list")
    public PageResponseResult pageList(ChannelDto channelDto) {
        return wmChannelService.pageList(channelDto);
    }

    @PostMapping("/api/v1/feign/wemedia/channel/update")
    public ResponseResult updateWnChannel(WmChannel wmChannel) {
        return wmChannelService.updateWnChannel(wmChannel);
    }
}
